
/**添加物流信息*/
function addBackupExp(){
	addStr = "<tr>";
	addStr += "<td>快递公司</td><td><input type='text' class='easyui-validatebox textbox' data-options='required:true,missingMessage:'请输入内容''></td>";
	addStr += "<td>物流单号</td><td><input type='text'class='easyui-validatebox textbox' data-options='required:true,missingMessage:'请输入物流单号''></td>";
	addStr += "</tr>";
	$("#add_backup_exp").append(addStr);
}
/**撤销一条物流信息*/
function cancelBackupExp(){
	$("#add_backup_exp").find("tr").last ().remove();
}

$("#backup_sub_btn").click(function(){
	$("#backup_order_form").form('submit', {    
		url:'customer/overseas_business/subBackup.do',   
	    onSubmit: function(){//发送前操作
	    	var isValid = $(this).form('validate');
			return isValid;	// 返回false终止表单提交
	    },    
	    success:function(data) {
	    	var data = eval('(' + data + ')');  
		        if(data.success == true){
		        	//subExps(data.result);
		        	$.messager.alert('提示','<strong><center>'+data.msg+'</center></strong>');
		        	$("#backup_order_form :input").val('');
		        }else{    
		        	$.messager.alert('警告','<strong><center>'+data.msg+'</center></strong>');    
		        }
		        if($('#tabs').tabs('exists',"我的备货发货订单")==true){
		        	$("#back_datagrid").datagrid('reload');
					$("#back_datagrid").datagrid('uncheckAll');
		    	}
		     }  
	});  
});

/**提交物流信息*/
function subExps(CH_NO){
	var saveDataAry=new Array();  
    $('#add_backup_exp tr').each(function(){
    	var attTd = $(this).children();
    	var box_val = $.trim(attTd.eq(1).find("input").val());
    	var exp_val = $.trim(attTd.eq(3).find("input").val());
    	if(box_val!="" || exp_val!=""){
    		var data = {"order_no":CH_NO,"box":box_val,"exp_no":exp_val};
        	saveDataAry.push(data);
    	}
    });
    $.ajax({ 
        type:"POST", 
        url:'customer/change_business/exp/submit.do',  
        dataType:"json",      
        contentType:"application/json",               
        data:JSON.stringify(saveDataAry), 
        success:function(data){ 
        	//var data = eval('(' + data + ')');
        	 if(data.success == true){
		        	return true;   
		        }else{    
		        	$.messager.alert('警告','<strong><center>'+data.msg+'</center></strong>');    
		        }    
        } 
    }); 
 }